import React, { Component } from 'react'

export default class UseStateClass extends Component {
  constructor() {
    super()
    this.state = {
      age: 18
    }
  }
  setAge(age) {
    this.setState({
      age: age
    })
  }
  render() {
    return (
      <div>
        <div>我是类组件</div>
        <p>{this.state.age}</p>
        <button onClick={() => this.setAge(69)}>+1</button>
      </div>
    )
  }
}
